package com.ioday01demo;

import java.io.*;
/*
缓冲流；是一对高级流 作用是加快读写效率
1.BufferedInputStream  缓冲输入流
2.BufferedOutputStream  缓冲输出流
缓冲流 底层有个8kb的字节数组
 */

public class CopyDemo3Buffered {
    public static void main(String[] args) throws IOException {
        long start = System.currentTimeMillis();
        FileInputStream fis = new FileInputStream("12.jpg");
        BufferedInputStream bis = new BufferedInputStream(fis);
        FileOutputStream fos = new FileOutputStream("16.jpg");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        int temp;
        while ((temp = bis.read()) != -1){
            bos.write(temp);
        }
        System.out.println("复制完成");
        bis.close();
        bos.close();
        long end = System.currentTimeMillis();
        System.out.println((end-start) + "毫秒");
    }
}
